<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$hdps =array(
		array('title'=>'首页','picurl'=>'../addons/jy_weishoplive/resource/img/hdp01.jpg','action'=>'index/'),
	);
	$footernav = array(
			array('title'=>'直播首页','icon'=>'icon-shouye','color'=>'#cc99ff','action'=>'jy_weishoplive/index/','image'=>'../addons/jy_weishop/resource/images/jy_weishoparticle.png'),
			array('title'=>'我的订阅','icon'=>'icon-caifua','color'=>'#66cc99','action'=>'jy_weishoplive/dy/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
			array('title'=>'观看记录','icon'=>'icon-manageorder','color'=>'#ff9933','action'=>'jy_weishoplive/his/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
	);
	$red_fees =array(
		array('fee'=>'10'),
		array('fee'=>'16'),
		array('fee'=>'18'),
		array('fee'=>'22'),
		array('fee'=>'28'),
		array('fee'=>'58'),
	);
	$return['item']=$this->plugin_setting('basic');
	$return['item']['hdps']=$return['item']['hdps']?:$hdps;
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$return['item']['red_fees']=$return['item']['red_fees']?:$red_fees;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本信息',
				'list'=>array(
					array('type'=>'string','title'=>'网站名称','name'=>'title'),
					array('type'=>'image','title'=>'网站logo','name'=>'logo'),
					array('type'=>'switch','title'=>'是否开启商品独立？','name'=>'is_onegoods','help'=>'开启后，只现实本插件商品！只显示本应用公告，文章等！'),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
				)
			),
			array(
				'title'=>'优惠券/红包/礼品设置',
				'list'=>array(
					array('type'=>'switch','title'=>'关闭发红包？','name'=>'nosendred'),
					array('type'=>'switch','title'=>'现金红包？','name'=>'ismoneyred','help'=>'默认是余额红包，在会员中心可见，开启后就是现金红包（直接发现金微信红包）'),
					array('type'=>'switch','title'=>'关闭主播发优惠券？','name'=>'nosendcoupon'),
					array('type'=>'checkbox','name'=>'couponids','title'=>'选择优惠券','options'=>'coupon','help'=>'主播随机送其中一个优惠券给所有在线粉丝'),
					array('type'=>'switch','title'=>'关闭送礼物功能？','name'=>'nosendliping'),
					array(
							'type'=>'array',
							'name'=>'red_fees',
							'add_tip'=>'添加一个红包选项',
								'list'=>array(
									array('type'=>'string','name'=>'fee','title'=>'红包面额'),
								),
								'details'=>array(
									array('type'=>'string','name'=>'fee','title'=>'红包面额','help'=>'必须是整数！'),	
								)
					)
				)
			),
			array(
				'title'=>'幻灯片',
					'list'=>array(
						array(
							'type'=>'array',
							'name'=>'hdps',
							'add_tip'=>'添加一个幻灯片',
								'list'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片'),
									array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
									
								),
								'details'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片','help'=>''),
									array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
									
								)
						)
					)
			),
			array(
							'title'=>'底部导航',
							'list'=>array(
								array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
							)
			),
		),
	);
	$coupon=pdo_getall('jy_weishop_coupon',array('uniacid'=>$_SESSION['uniacid']),array('id','title'));
	$return['coupon']=array();
	foreach($coupon as $v){
		$id=$v['id'];
		$return['coupon'][$id]=$v['title'];
	}
	$return['htmls']=$htmls;
	exi($return);
}
/*******basic*******/
/*******op*******/
